package com.kehutong.charge.dao;

import com.kehutong.charge.dto.ChargeBillItemDTO;
import com.kehutong.charge.entity.ChargePenaltyOrder;
import org.coraframework.orm.annotation.Dao;
import org.coraframework.orm.annotation.Mapper;
import org.coraframework.orm.jdbc.execute.Condition;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@Dao
public interface ChargeBillHouseDao {

	@Mapper(
			genericType = HashMap.class,
			sql= "SELECT billYearMonth,chargeDate,billStatus,houseNo, billAddress, chargeName, COUNT(1) totalNum ," +
					"billCycleStart,billCycleEnd,billDate,IFNULL(SUM(payableAmount),0.00) payableAmountTotal," +
					"IFNULL(SUM(billAmount),0.00) billTotalAmount From `t_charge_bill_items` WHERE${}"
	)
	List<Map<String, Object>> houseMonthBill(Condition... condition);


	@Mapper(
			genericType = ChargeBillItemDTO.class,
			sql= "SELECT '违约金' feeTypeName,'' feeTypeNo,'9' billStatus ,o.billYearMonth,'' usageNumber,'' calcUnit,o.houseBillNo,'' itemBillNo,IFNULL(SUM(o.payableAmount),0.00) billAmount," +
					"0 payableAmount,IFNULL(SUM(o.paymentAmount),0.00) paymentAmount," + "IFNULL(SUM(o.negotiateAmount),0.00) negotiateAmount FROM t_charge_penalty_order o WHERE${}"
	)
	List<ChargeBillItemDTO> housePenalty(Condition... condition);

}
